﻿
@{
    ViewBag.Title = "Tìm Trường Theo Tiêu Chí";
    Layout = "~/Views/Shared/FE/_Layout_FE_Index.cshtml";
}
<link href="@Url.Content("~/Content/FE/Addition.css")" rel="stylesheet" type="text/css" />
<style type="text/css">
    #CityID, #DistrictID, #SchoolTypeID, #Fee {
        background: none repeat scroll 0 0 padding-box rgba(255, 255, 255, 0.9);
        border-color: rgba(23, 51, 78, 0.15) rgba(23, 51, 78, 0.17) rgba(23, 51, 78, 0.2);
        border-image: none;
        border-radius: 2.5px 0 0 2.5px;
        border-style: solid;
        border-width: 1px;
        box-shadow: 0 1px 0 rgba(8, 22, 37, 0.02) inset, 0 0 2px rgba(8, 22, 37, 0.1) inset, 0 1px 0 rgba(255, 255, 255, 0.2);
        padding: 5px 8px;
        width: 260px;
        margin: 15px;
        margin-bottom: 0px;
    }
    #ListService {
        line-height: 28px;
        padding: 5px 8px;
        width: 260px;
        height: 150px;
        overflow: auto;
        margin: 15px;
        border: 1px solid;
        border-color: rgba(23, 51, 78, 0.15) rgba(23, 51, 78, 0.17) rgba(23, 51, 78, 0.2);
    }
</style>
<div class="allhome">
    <div class="dashboard">
        <div class="content-header">
            <div class="header-inner">
        <script type="text/javascript">
            $(document).ready(function () {
                var cboCity = $(document).find('select[name="CityID"]');
                var divListService = $(document).find('div[name="ListService"]');
                var cboType = $(document).find('select[name="SchoolTypeID"]');
                cboCity.ready(function (e) {
                    var cid = cboCity.val();
                    // Load district Combo by cityID
                    var url2 = '@Url.Action("GetCityOptionsByGet", "Function")';
                    $.getJSON(url2, { ajax: 'true' }, function (response) {
                        var result = response.Result;
                        var options = '<option value="0">-- Tất cả thành phố --</option>';
                        cboCity.html(options);
                        if (result == 'OK') {
                            var rows = response.Options;
                            for (var k = 0; k < rows.length; k++) {
                                options += '<option value="' + rows[k].Value + '">' +
                                    rows[k].DisplayText + '</option>';
                            }
                        }
                        cboCity.html(options);
                    });
                });

                cboType.ready(function (e) {
                    var cid = cboCity.val();
                    // Load district Combo by cityID
                    var url2 = '@Url.Action("GetSchoolTypeOptionsByGet", "Function")';
                    $.getJSON(url2, { ajax: 'true' }, function (response) {
                        var result = response.Result;
                        var options = '<option value="0">-- Tất cả loại trường --</option>';
                        cboType.html(options);
                        if (result == 'OK') {
                            var rows = response.Options;
                            for (var k = 0; k < rows.length; k++) {
                                options += '<option value="' + rows[k].Value + '">' +
                                    rows[k].DisplayText + '</option>';
                            }
                        }
                        cboType.html(options);
                    });
                });

                divListService.ready(function (e) {
                    var cid = cboCity.val();
                    // Load district Combo by cityID
                    var url2 = '@Url.Action("GetServiceCheckListByGet", "Function")';
                    $.getJSON(url2, { ajax: 'true' }, function (response) {
                        var result = response.Result;
                        var options = '';
                        if (result == 'OK') {
                            var rows = response.Options;
                            for (var k = 0; k < rows.length; k++) {
                                options += '<div><input type="checkbox" id="ServiceID" name="ServiceID" value="' + rows[k].Value + '">    ' +
                                    rows[k].DisplayText +"</div>";
                            }
                        }
                        divListService.html(options);
                    });
                });
                var cboLine = $(document).find('select[name="DistrictID"]');

                // City ComboBox Change
                cboCity.change(function (e) {
                    var cid = $(this).val();
                    if (cid == 0) {
                        cboLine.hide();
                        return;
                    }
                    // Refresh District Combo
                    var url = '@Url.Action("GetDistrictOptions", "Function")' + '?cityId=' + cid;
                    $.getJSON(url, { ajax: 'true' }, function (response) {
                        var result = response.Result;
                        var options = '<option value="0">-- Tất cả quận huyện --</option>';

                        cboLine.html(options);
                        if (result == 'OK') {
                            var rows = response.Options;
                            for (var i = 0; i < rows.length; i++) {
                                options += '<option value="' + rows[i].Value + '">' +
                                    rows[i].DisplayText + '</option>';
                            }
                        }
                        cboLine.html(options);
                        cboLine.show();
                        cboLine.change();
                    });

                });
            });
        </script>
        <div class="rightTxt1" id="search_01" style="position: relative; ">
            <form class="search-condition" action="@Url.Action("SearchConditionResult","School")" method="GET" style="padding: 10px;">
                <p>Lựa chọn những tiêu chí phù hợp dưới đây</p>
                    <select id="CityID" name="CityID">
                    </select>
                <select id="DistrictID" name="DistrictID" style="display: none;">
                    <option value="0">-- Tất cả Quận Huyện --</option>
                </select>
                    <select id="SchoolTypeID" name="SchoolTypeID">
                    </select>
                    <select id="Fee" name="Fee">
                        <option value="1">-- Tất Cả Mức Học Phí (VNĐ) --</option>
                        <option value="2">Dưới 1.000.000</option>
                        <option value="3">1.000.000-2.000.000</option>
                        <option value="4">2.100.000-3.000.000</option>
                        <option value="5">3.100.000-4.000.000</option>
                        <option value="6">4.100.000-5.000.000</option>
                        <option value="7">Trên 5.000.000</option>
                    </select>
                
                    <div id="ListService" name="ListService">
                    
                    </div>
                <input type="submit" value="Tìm Kiếm" id="search1"/>
            </form>
        </div>
    </div>
      </div>
    </div>
</div>